<template>
    <div>
          <el-form :inline="true" :model="searchDate" class="demo-form-inline">
            <el-form-item label="学校名称:">
                <el-input v-model="searchDate.name" placeholder="学校名称"></el-input>
            </el-form-item>

            <el-form-item>
                <el-button type="primary" @click="SelectMultipel">查询</el-button>
            </el-form-item>
        </el-form>
        <el-table v-if="tableData3.length>0" :data="tableData3" border style="width: 100%"  highlight-current-row
    @current-change="SelctSchool">
            <el-table-column prop="SCHOOL_ID" label="ID" width="180">
            </el-table-column>
            <el-table-column prop="SCHOOL_NAME" label="学校名称" width="180">
            </el-table-column>
            <el-table-column prop="SCHOOL_CITY" label="学校所属州省" width="150">
            </el-table-column>
            <el-table-column prop="SCHOOL_WEB" label="学校网址" width="180">
            </el-table-column>
            <el-table-column prop="SCHOOL_ADDRESS" label="学校具体地址" width="200">
            </el-table-column>
            <el-table-column prop="SCHOOL_PRODUCE" label="推荐购买套餐" width="200">
            </el-table-column>
            
            <el-table-column label="操作" width="100">
                <template scope="scope">
                    <el-button type="text" size="media" @click="schoolEditer(scope.row.SCHOOL_ID)">
                        <i class="el-icon-view"> 查看</i>
                    </el-button>
                </template>
            </el-table-column>
        </el-table>
        <div class="block">
            <el-pagination @current-change="handleCurrentChange" :current-page="currentPage1" :page-size="10" layout="total, prev, pager, next" :total="pagecount">
            </el-pagination>
        </div>
    </div>
</template>
<script>
import api from "@/js/api";
export default {
  data() {
    return {
      pagecount: 0,
      currentPage1: 1,
      tableData3: [],
      searchDate: {
        name: "",
        address: ""
      }
    };
  },
  methods: {   
    SelectMultipel() {
    var  data= this.searchDate ;
      let that = this;
      var sdata = {
        name: data.name == "" ? null : data.name,
        address: data.address == "" ? null : data.address,
        pageIndex: this.currentPage1,
        pageSize: 10
      };
      api.schoolSelectMultipel(that, sdata, function(msg) {
        that.tableData3 = msg.Result;
        that.pagecount = msg.ListCount;
      });
    },
    handleCurrentChange(val) {
      this.currentPage1 = val;
      this.SelectMultipel(this.searchDate);
    },   
    getDate() {
      let that = this;
      api.schoolGetList(
        that,
        { pageIndex: this.currentPage1, pageSize: 10 },
        function(msg) {
          that.tableData3 = msg.Result;
          that.pagecount = msg.ListCount;
        }
      );
    },  
    //选择一个
    SelctSchool(val){
 this.$emit("SelctSchool", val);
    }
   
  },
  created() {
    this.getDate();
  }
};
</script>
